import {DataTypes} from "sequelize";
import _bill from './model/bill.js';
import _user from './model/user.js';
import _category from './model/category.js';
import _company from './model/company.js';
import _company_user from './model/company_user.js';
import _depot from './model/depot.js';
import _depot_record from './model/depot_record.js';

// 自动生成mysql 然后返回函数生成的模型
function initModels(sequelize) {
  const bill = _bill(sequelize, DataTypes);
  const user = _user(sequelize, DataTypes);
  const category = _category(sequelize, DataTypes);
  const company = _company(sequelize, DataTypes);
  const companyUser = _company_user(sequelize, DataTypes);
  const depot = _depot(sequelize, DataTypes);
  const depotRecord = _depot_record(sequelize, DataTypes);

  bill.sync();
  user.sync();
  category.sync();
  company.sync();
  companyUser.sync();
  depot.sync();
  depotRecord.sync();
  return {
    bill,
    user,
    category,
    company,
    companyUser,
    depot,
    depotRecord,
  };
}
export default initModels;
